<template>
	<view class="global">
		<view id="allmap" class="map"></view>
	</view>

</template>

<script type="module">
	import {
		mymap
	} from "@/utils/map.js";
	var bmap = null;
	export default {
		data() {
			return {
				ak: 'ByhRV12RgHylG504w8sqcBzSEdm5EXN0'
			}
		},
		methods:{
			searchLocation(){
				uni.getLocation({
					type: 'wgs84',
					geocode: true, //设置为true可直接获取经纬度及城市信息
					success: (res) => {
						
					}
					
				})
			}
		},
		mounted() {
			mymap(this.ak).then((mymap) => {
				// 创建百度地图实例				
				bmap = new BMapGL.Map("allmap");
				console.log(bmap, 'this.map')
				let point = new BMapGL.Point(122.162964, 30.064204);
				bmap.centerAndZoom(point, 12); //设置缩放级别		
				bmap.enableScrollWheelZoom();
				
				//地图检索功能
				
				
			});
		},

	}
</script>

<style lang="scss" scoped>
	.global {
		width: 100%;
		height: 100%;
	}

	.map {
		width: 100%;
		height: 500rpx;
	}



	#allmap {
		// width: 100%;
		// height: 100%;
		width: 750rpx;
		height: 750rpx;
	}
</style>